package design_patterns;

/**
 * 外观模式（门面模式）
 * @author Fairy
 */
public class FacadePattern {
    public static void main(String[] args) {
        Facade facade = new Facade();
        facade.methodA();
        facade.methodB();
    }
}
class SubSystemOne {
    public void methodOne() {
        System.out.println("子系统方法一");
    }
}
class SubSystemTwo {
    public void methodTwo() {
        System.out.println("子系统方法二");
    }
}
class SubSystemThree {
    public void methodThree() {
        System.out.println("子系统方法三");
    }
}
class Facade {
    SubSystemOne one;
    SubSystemTwo two;
    SubSystemThree three;

    public Facade() {
        one = new SubSystemOne();
        two = new SubSystemTwo();
        three = new SubSystemThree();
    }
    public void methodA() {
        System.out.println("\n方法组A() --- ");
        one.methodOne();
        two.methodTwo();
    }
    public void methodB() {
        System.out.println("\n方法组B() --- ");
        one.methodOne();
        three.methodThree();
    }
}